package com.smp.dsandroidtester.ds;

public abstract class NativeQueueBase extends DSNativeWrapper  {
	private long mNativeHandle;

	public NativeQueueBase() {
		super();
	}
	
	protected void initAsIntArrayQueue(int aSize, boolean abConcurrent) {
		mNativeHandle = createIntArrayQueue(aSize, abConcurrent);
	}

	protected void initAsIntLinkedQueue(int aSize, boolean abConcurrent) {
		mNativeHandle = createIntLinkedQueue(aSize, abConcurrent);
	}
	
	@Override
	protected void finalize() throws Throwable {
		if(mNativeHandle != 0) {
			destroyDS(mNativeHandle);
		}
		super.finalize();
	}
	
	public void offer(int anData) {
		offerIntQueue(mNativeHandle, anData);
	}
	
	public int poll() {
		return pollIntQueue(mNativeHandle);
	}
	
	public int peek() {
		return peekIntQueue(mNativeHandle);
	}
	
	public boolean canOffer() {
		return canOfferIntQueue(mNativeHandle);
	}
	
	public boolean canPoll() {
		return canPollIntQueue(mNativeHandle);
	}
	
	public int getDataCount() {
		return getDataCountIntQueue(mNativeHandle);
	}
}
